#include "widget.h"
#include "ui_widget.h"
#include <QIcon>
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //设置标题
    this->setWindowTitle("标题");
    //设置图标
    QIcon icon(":/ju.jpg");
    this->setWindowIcon(icon);

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    //设置透明度(0-1)
    float opacity = this->windowOpacity();
    qDebug() << opacity;
    if(opacity >= 1)return;
    opacity += 0.1;
    this->setWindowOpacity(opacity);
}

void Widget::on_pushButton_2_clicked()
{
    float opacity = this->windowOpacity();
    qDebug() << opacity;
    if(opacity <= 0)return;
    opacity -= 0.1;
    this->setWindowOpacity(opacity);
}
